package com.jinzecloud.reportapproval.bean;

import cn.hutool.core.collection.ListUtil;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.jinzecloud.reportapproval.enums.StateEnum;
import com.jinzecloud.reportapproval.enums.TableEnums;
import com.jinzecloud.reportapproval.utils.AuditUtil;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.Date;
import java.util.List;

@Data
@TableName("handover_checklist")
@Accessors(chain = true)
public class HandoverChecklist {

    /**
     * id
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    private String projectCode;

    /**
     * 项目编号
     */
    private String projectNumber;

    /**
     * 产品名称
     */
    private String productName;

    /**
     * 起止日期
     */
    @JsonFormat(pattern = "yyyy日MM月dd日")
    private String startDate;

    @JsonFormat(pattern = "yyyy日MM月dd日")
    private String endDate;

    /**
     * 规格型号
     */
    private String specificationModel;

    /**
     * 移交日期
     */
    @JsonFormat(pattern = "yyyy年MM月dd日")
    private String handoverDate;

    /**
     * 移交人
     */
    private String handoverPerson;

    /**
     * 接收人
     */
    private String receiver;

    /**
     * 此表所列资料经查验,册数、页数无误，准予归档。
     */
    private Boolean checkList;

    /**
     * 技术文件、资料名称共几页
     */
    private String technicalDocumentsName;

    /**
     * 任务流程记录
     */
    private String taskFlowRecord;

    public List<String> getTaskFlowRecordList() {
        if (taskFlowRecord == null) return ListUtil.empty();
        return ListUtil.toList(taskFlowRecord.split(","));
    }

    /**
     * 补充资料
     */
    private String supplementaryMaterials;

    /**
     * 共几页
     */
    private String totalPage;

    /**
     * 检测记录
     */
    private String checkRecord;

    /**
     * 补充资料
     */
    private String supplementaryMaterialsCheck;

    /**
     * 共几页
     */
    private String totalPageCheck;

    /**
     * 其它相关技术资料
     */
    private String otherTechnicalDocuments;

    /**
     * 补充资料
     */
    private String supplementaryMaterialsOtherTechnicalDocuments;

    /**
     * 共几页
     */
    private String otherTechnicalDocumentsTotalPage;

    /**
     * 推广鉴定报告及检验报告
     */
    private String promotionIdentificationReportAndInspectionReport;

    /**
     * 共几页
     */
    private String promotionIdentificationReportAndInspectionReportTotalPage;

    /**
     * 备注
     */
    private String remarks;

    /**
     * 状态
     */
    private Integer state = StateEnum.UN_SUBMIT.getState();

//    @TableField(exist = false)
//    private String stateText;
//
//    public String getStateText() {
//        return AuditUtil.getStateText(TableEnums.HANDOVER_CHECK_LIST.getTableName(), state).getDesc();
//    }

    /**
     * 创建用户id
     */
    private Integer createdUserId;

    /**
     * 审核意见
     */
    private String auditOpinion;

    /**
     * 审核时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
    private Date auditDate;

    /**
     * 生成word地址
     */
    private String wordPath;

    /**
     * 生成pdf地址
     */
    private String pdfPath;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
    private Date createTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
    private Date updateTime;

}
